home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / pt20pc.zip / GLOBALS.C < prev    next >
C/C++ Source or Header  |  1991-02-04  |  13KB  |  399 lines

  1. #include "pt.h"
  2. #include "time.h"
  3.  
  4. /* remember the menu number of the topline menu */
  5. int toplineMenu = 0;
  6.  
  7. /* to support automatic saving */
  8. time_t timeOfLastSave;
  9.  
  10. /* alternate open file table so we can open more than 20 files */
  11. unsigned char far * fileHandleTable;
  12.  
  13. /* for finding TAGS */
  14. unsigned char tagPattern[64];
  15. unsigned char tagMarker[32];
  16. unsigned char lastTag[STRINGSIZE];
  17. unsigned char tagDTA[64];
  18. long tagLastCp = -1;
  19. int tagLastLine;
  20.  
  21. /* for finding keywords */
  22. unsigned char lastKeyword[STRINGSIZE];
  23. unsigned char keywordDTA[64];
  24. long keywordLastCp = -1;
  25. int keywordLastLine;
  26.  
  27. /* So that multiple ones will reduce to one message (used in pt.c) */
  28. int supressFileMsgs = 0;
  29.  
  30. #ifdef OVERLAYS
  31. /* names of the overlays */
  32. unsigned char primaryOverlay[70];
  33. unsigned char secondaryOverlay[70];
  34. unsigned char overlayString[128];
  35. unsigned char *overlayArguments;
  36. int overlayState;
  37. int quitExecuted = 0;
  38. /* 0 ==> no overlay is active */
  39. /* 1 ==> primary overlay only is loaded */
  40. /* 2 ==> secondary overlay only is loaded */
  41. /* 3 ==> primary and secondary overlays are both loaded */
  42. /* 4 ==> unloading secondary overlay */
  43.  
  44. /* files to reopen after the overlay returns */
  45. int filesToOpen = 0;
  46. int primaryFilesToOpen = 0;
  47. struct openFile *ffsToOpen[20];
  48.  
  49. /* overlay command pointers */
  50. unsigned char *overlayMap[56];
  51.  
  52. #endif
  53.  
  54. /* to allow programming of the mouse sensitive window parts */
  55. unsigned char windowPoints[10] = {28, 88, 28, 88, 28, 88, 28, 88, 66, 27};
  56. /* windowPoints[0] => top left corner, left button */
  57. /* windowPoints[1] => top left corner, middle button */
  58. /* windowPoints[2] => top right corner, left button */
  59. /* windowPoints[3] => top right corner, middle button */
  60. /* windowPoints[4] => bottom left corner, left button */
  61. /* windowPoints[5] => bottom left corner, middle button */
  62. /* windowPoints[6] => bottom right corner, left button */
  63. /* windowPoints[7] => bottom right corner, middle button */
  64. /* windowPoints[8] => right border, left button */
  65. /* windowPoints[9] => right border, right button */
  66.  
  67. /* character table for fillLine (in windtext.c) */
  68. unsigned char charTable[256];
  69.  
  70. /* stack location */
  71. unsigned char *stktop;
  72.  
  73. /* scratch file name */
  74. unsigned char scratchFileName[FILENAMESIZE];
  75.  
  76. /* remember directories during getFileName */
  77. unsigned char startDirectory[FILENAMESIZE];
  78. unsigned char startDrive;
  79. unsigned char currentDirectory[FILENAMESIZE];
  80. unsigned char currentDrive;
  81.  
  82. /* keep records so we can move cursor consistently in vertical direction */
  83. int lastColumn = -1;
  84. int lastFn = 0;
  85.  
  86. /* mouse speed parameter */
  87. int mouseSpeed = 4;
  88.  
  89. /* mouse motion parameters */
  90. int quad22 = 25;
  91. int quad45 = 45;
  92. int quad67 = 175;
  93.  
  94. /* mouse motion commands */
  95. int mouseVec1[9] = {
  96. FCOPY, FBACKSEARCH, FDELETE, FMOVETO, FINSKEY,
  97. FREPSEARCH, FREDO, FCOPYTO, FUNDO,
  98. };
  99.  
  100. int mouseVec2[9] = {
  101. FEXTEND, FGOBACKTO, FDELNOSCRAP, FEXCHSCRAP, FCANCEL,
  102. FCONTEXTMENU, FBOTTOM, FCOPYSCRAP, FCLOSEWINDOW,
  103. };
  104.  
  105. /* keyboard macro */
  106. unsigned char macroText[102];
  107. int macroIndex = 0;
  108. int macroSize = 0;
  109. int macroState = 0;
  110.  
  111. /* longjmp here in case of crtl-break */
  112. jmp_buf breakEnv;
  113.  
  114. /* remember is there is a message showing on the bottom line */
  115. int isMessage = 0;
  116.  
  117. /* file id for the "pt.msg" command descriptions file */
  118. int descrFileId = -1;
  119.  
  120. /* remember whether to erase the description message */
  121. int lastOnTopline = 0;
  122.  
  123. /* remember the last command the user selected (for help) */
  124. int lastCommand = FHELP;
  125.  
  126. /* remember the top line menu that is currently showing */
  127. int menuShowing = 0;    /* default to no menu */
  128.  
  129. /* for mouse button events */
  130. int evhead, evtail;
  131. struct event *evaddr;
  132. struct event events[NEVENTS];
  133.  
  134. int passEvhead;
  135. long passCp;
  136.  
  137. /* variable to remember the last character we ignored */
  138. unsigned char lastIgnored;
  139.  
  140. /* current screen size */
  141. int scrRows = 25;
  142. int scrCols = 80;
  143.  
  144. /* piece table */
  145. struct piece *freePList;
  146. unsigned int bytesLeft;
  147. unsigned int piecesLeft;
  148.  
  149. /* save the old video mode */
  150. unsigned char saveVideoMode;
  151.  
  152. /* the globals additions file */
  153. unsigned char addFile[65];
  154. int addHandle;
  155. long addPosition;
  156.  
  157. /* colors for window things -- global versions */
  158. unsigned char textColor    = 0x07;    /* normal text */
  159. unsigned char selColor    = 0x70;    /* selection */
  160. unsigned char bannerColor= 0x70;    /* top line banner */
  161. unsigned char borderColor= 0x07;    /* borders (other than the top) */
  162. unsigned char elevColor    = 0x0F;    /* left border elevator */
  163.  
  164. struct colorCycle colorCycles[NCOLORCYCLES];
  165. unsigned char maxTextCycles = 0;
  166. unsigned char maxBorderCycles = 0;
  167.  
  168. /* global message colors */
  169. unsigned char errorColor = 0xF0;    /* error messages */
  170. unsigned char promptColor= 0x0F;    /* prompt messages */
  171. unsigned char msgColor      = 0x07;    /* informational messages */
  172. unsigned char topColor   = 0x07;    /* top menu line */
  173.  
  174. /* mouse menus */
  175.  
  176. /* space for menu items read from pt.ini (allocated in far * space) */
  177. unsigned char far *menuSpace;
  178. int nextSpace = 0;
  179.  
  180. struct menuBlock far *menus[NMENUS];
  181. /* menu 0 is for dynamic menus (TOPLIST and help) */
  182. /* menus 1 to NMENUS-1 are for users */
  183.  
  184. /* what to do with button presses inside or outside a window */
  185. unsigned char buttonVector[64];
  186.  
  187. /* what to do with button presses on the top line */
  188. unsigned char toplineVector[64];
  189.  
  190. /* debugging flag */
  191. int debug = 0;
  192.  
  193. /* some option flags */
  194. int autoSaveInterval = 0;
  195. int autoScrollRate = 2;
  196. int autoIndent = 1;
  197. int nBuffers = 50;
  198. int centerMenus = 0;
  199. int cursorMouse = 0;
  200. int doubleClickDelay = 50;
  201. int fileSort = 2;
  202. int findWholeWords = 0;
  203. unsigned char fsDirs[200];
  204. unsigned char fsPatterns[128];
  205. unsigned char filePattern[64];
  206. int fsMenu = 1;
  207. int pathNames = 1;
  208. int helpMode = 2;
  209. int ignoreCase = 1;
  210. int initialWindows = 0;
  211. #ifdef OVERLAYS
  212. int overlayVector = 0x61;
  213. #endif
  214. int maxFiles = 20;
  215. int menuLine = 0;
  216. int i43lines = 0;
  217. int overType = 0;
  218. int readOnly = 0;
  219. int reSearch = 0;
  220. int rightMargin = 999;
  221. int scrollDelay = 75;
  222. int scrollRate = 0;
  223. int searchMode = 0;
  224.     /* not an option, used to make backwards search circular */
  225.     int realSearchMode = -1;
  226. int smoothScroll = 1;
  227. int tabWidth = 8;
  228. int topOnFind = 0;
  229. int linesOverFind = 4;
  230. int undoSize = NHISTORY;
  231. int unixMode = 0;
  232. int videoMode = 0;
  233.  
  234. struct optionItem options[] = {
  235. {"43lines",        O43LINES, &i43lines,    OBOOLEAN, FI43LINES},
  236. {"findWholeWords", 0,     &findWholeWords, OBOOLEAN, FFINDWHOLEWORDS},
  237. {"ignoreCase",     0,     &ignoreCase,     OBOOLEAN, FIGNORECASE},
  238. {"searchMode",     0,     &searchMode,     OINTEGER, FSEARCHMODE},
  239. {"topOnFind",      0,     &topOnFind,      OBOOLEAN, FTOPONFIND},
  240. {"linesOverFind",  0,     &linesOverFind,  OINTEGER, FLINESOVERFIND},
  241. {"filePattern",  0,(int *)&filePattern[0], OSTRING,  FFILEPATTERN},
  242. {"autoSaveInterval",0,    &autoSaveInterval,OINTEGER,FAUTOSAVEINTERVAL},
  243. {"autoScrollRate", 0,     &autoScrollRate, OINTEGER, FAUTOSCROLLRATE},
  244. {"tabWidth",       0,     &tabWidth,       OINTEGER, FTABWIDTH},
  245. {"autoIndent",     0,     &autoIndent,     OBOOLEAN, FAUTOINDENT},
  246. {"rightMargin",    0,     &rightMargin,    OINTEGER, FRIGHTMARGIN},
  247. {"overType",       0,     &overType,       OBOOLEAN, FOVERTYPE},
  248. {"pathNames",      0,     &pathNames,      OBOOLEAN, FPATHNAMES},
  249. {"doubleClickDelay",0,    &doubleClickDelay,OINTEGER,FDOUBLECLICKDELAY},
  250. {"smoothScroll",   0,     &smoothScroll,   OBOOLEAN, FSMOOTHSCROLL},
  251. {"centerMenus",    0,     ¢erMenus,    OBOOLEAN, FCENTERMENUS},
  252. {"helpMode",       0,     &helpMode,       OINTEGER, FHELPMODE},
  253. {"textColors",     OTEXTCOLORS, &debug,    OOTHERS,  FTEXTCOLORS},
  254. {"readOnly",       0,     &readOnly,       OBOOLEAN, FOREADONLY},
  255. {"reSearch",       0,     &reSearch,       OBOOLEAN, FRESEARCH},
  256. {"Redefine ...",   OREDEFINE, &debug,      OOTHERS,  FREDEFINE},
  257. {"scrollRate",     0,     &scrollRate,     OINTEGER, FSCROLLRATE},
  258. {"scrollDelay",    0,     &scrollDelay,    OINTEGER, FSCROLLDELAY},
  259. {"borderColors",   OBORDERCOLORS, &debug,  OOTHERS,  FBORDERCOLORS},
  260. {"msgColors",      OMSGCOLORS, &debug,     OOTHERS,  FMSGCOLORS},
  261. {"tagP